package com.thinkgem.jeesite.common.utils;

import com.thinkgem.jeesite.modules.lottery.entity.*;
import com.thinkgem.jeesite.modules.lottery.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.method.P;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MapListUtils{
    @Autowired
    private ActivityService activityService;
    @Autowired
    private ActivityStatusService activityStatusService;
    @Autowired
    private ActivityFormService activityFormService;
    @Autowired
    private WechatUserService wechatUserService;
    @Autowired
    private WechatActorService wechatActorService;
    @Autowired
    private PrizeService prizeService;

    public List<ActivityStatus> getStatus(){
        return activityStatusService.findList(new ActivityStatus());
    }
    public List<ActivityForm> getForms(){
        return activityFormService.findList(new ActivityForm());
    }
    public List<WechatUser> getMangers(){
        String actorId="";
        for(WechatActor wa:wechatActorService.findList(new WechatActor())){
            if("抽奖管理员".equals(wa.getName())){
                actorId=wa.getId();
                System.out.println(actorId);
                break;
            }
        }
        WechatUser wu = new WechatUser();
        wu.setActorId(actorId);
        System.out.println(wu.toString());
        return wechatUserService.findList(wu);
    }
    public List<Prize> getPrizes(String activityid){
        Prize temp = new Prize();
        temp.setActivityId(activityid);
        if (activityid==null){
            return null;
        }
        return prizeService.findList(temp);
    }
    public List<WechatUser> getWechatUsers(){
        return wechatUserService.findList(new WechatUser());
    }
    public List<WechatActor> getWechatActors(){
        return wechatActorService.findList(new WechatActor());
    }
    public List<Activity> getActivities(){
        return activityService.findList(new Activity());
    }

    public List<Prize> getPrizes() {
        return prizeService.findList(new Prize());
    }
}
